<?php $this->_extends('../_layouts/default_layout');?>
<?php $this->_block('contents');?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.mselect.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.multiselect.js"></script>
<script type="text/javascript">
$(function(){
	$(".datepicker").datepicker({dateFormat: 'yy-mm-dd', changeMonth: true});
	$("#shop_ids").multiselect({height: 260, minWidth: 160});
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<?include (Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>创建时间</th>
	<td>
		<input type="text" class="datepicker" name="begin_create_time" value="<?=isset($_GET['begin_create_time']) ? $_GET['begin_create_time'] : ''?>" /> To
		<input type="text" class="datepicker" name="end_create_time" value="<?=isset($_GET['end_create_time']) ? $_GET['end_create_time'] : ''?>" />
	</td>
</tr>
<tr>
	<th>更新时间</th>
	<td>
	<input type="text" class="datepicker" name="begin_update_time" value="<?=isset($_GET['begin_update_time']) ? $_GET['begin_update_time'] : ''?>" /> To
		<input type="text" class="datepicker" name="end_update_time" value="<?=isset($_GET['end_update_time']) ? $_GET['end_update_time'] : ''?>" />
	</td>
</tr>
<tr>
	<th>纠纷编号</th>
	<td><input type="text" name="case_id" value="<?=isset($_GET['case_id']) ? $_GET['case_id'] : ''?>" /></td>
</tr>
<tr>
	<th>买家ID</th>
	<td><input type="text" name="buyer" value="<?=isset($_GET['buyer']) ? $_GET['buyer'] : ''?>" /></td>
</tr>
<tr>
	<th>店铺</th>
	<td>
		<select name="shop_ids[]" multiple="multiple" id="shop_ids">
			<optgroup label="ebay">
				<?foreach ($shop as $s):?>
				<option value="<?=$s['id']?>" <?if (isset($_GET['shop_ids']) && in_array($s['id'], $_GET['shop_ids'])):?>selected="selected"<?endif;?>><?=$s['name']?></option>
				<?endforeach;?>
			</optgroup>
		</select>
	</td>
</tr>
<tr>
	<th>纠纷类型</th>
	<td>
		<?foreach (Q::ini('custom_flag/services_ebay_case_type') as $t):?>
		<label><input type="checkbox" name="type[<?=$t['value']?>]" value="<?=$t['value']?>" <?if (isset($_GET['type']) && array_key_exists($t['value'], $_GET['type'])):?>checked="checked"<?endif;?> /><?=$t['name']?>&nbsp;</label>
		<?endforeach;?>
	</td>
</tr>
<tr>
	<th>纠纷状态</th>
	<td>
		<label><input type="checkbox" name="status[]" value="MY_RESPONSE_DUE" <?if (isset($_GET['status']) && in_array('MY_RESPONSE_DUE', $_GET['status'])):?>checked="checked"<?endif;?> />MY_RESPONSE_DUE </label>
		<label><input type="checkbox" name="status[]" value="OTHER_PARTY_RESPONSE_DUE" <?if (isset($_GET['status']) && in_array('OTHER_PARTY_RESPONSE_DUE', $_GET['status'])):?>checked="checked"<?endif;?> />OTHER_PARTY_RESPONSE_DUE </label>
		<label><input type="checkbox" name="status[]" value="CLOSED" <?if (isset($_GET['status']) && in_array('CLOSED', $_GET['status'])):?>checked="checked"<?endif;?> />CLOSED </label>
	</td>
</tr>
<tr>
	<td colspan="2"><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<table class="list_table" width="100%">
<tr>
	<th>纠纷编号</th>
	<th>ItemID</th>
	<th>买家账号</th>
	<th>店铺账号</th>
	<th>金额</th>
	<th>创建时间</th>
	<th>交易时间</th>
	<th>间隔(天)</th>
	<th>更新时间</th>
	<th>类型</th>
	<th>状态</th>
</tr>
<?foreach ($case as $c):?>
<tr>
	<td>
			<a href="<?=url('Services::EbayCase/Detail', array('id' => $c['id']))?>" target="_blank" title="查看纠纷详细"><?=$c['case_id']?></a>
	</td>
	<td><a href="<?=url('Online::EbayListing/list', array('item_id' => $c['shop_item_id']))?>" target="_blank" title="查看itemID详细"><?=$c['shop_item_id']?></a></td>
	<td><?=$c['buyer']?></td>
	<td><?=$c['shop_name']?></td>
	<td><?=$c['currency_symbol']?><?=sprintf('%.2f', $c['amount'])?></td>
	<td width="80"><?=$c['create_time']?></td>
	<td width="80"><?=$c['transaction_time']?></td>
	<td width="40"><?=$c['transaction_time'] ? ceil(((strtotime($c['create_time']) - strtotime($c['transaction_time'])) / (3600 * 24))) : ''?></td>
	<td width="80"><?=$c['update_time']?></td>
	<td><?=Helper_BSS_Normal::getIniOne('services_ebay_case_type', 'value', $c['type'], 'name')?></td>
	<td><?=$c['status']?></td>
</tr>
<?endforeach;?>
</table>
<?=$page;?>
<?php $this->_endblock();?>